$(document).on('page-change', function () {
    setTimeout(function () {
        if (frappe.get_route().length >= 2 && frappe.get_route()[0] === 'Form') {
            replace_timeline_content()
            setInterval(replace_timeline_content, 60000);
        }
    },
        500)
});

function replace_timeline_content() {
    // console.log('replace_timeline_content')
    let timeline_el_list = $('.timeline-content');
    if (timeline_el_list.length > 0) {
        timeline_el_list.each(function () {
            let $el = $(this);
            let $timestamp = $el.find('.frappe-timestamp').first();
            if ($timestamp.length > 0) {
                let title = $timestamp.attr('title');
                $timestamp.html('')
                $timestamp.html(`<span>${comment_when(title)}</span> <span> · ${title}</span>`);
            }
        });
    }
}